<?php

namespace app\admin\model;

use think\Model;
use traits\model\SoftDelete;

class Middleman extends Model
{
    use SoftDelete;
    // 表名
    protected $name = 'middleman';
    
    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = 'datetime';
    protected $dateFormat = 'Y-m-d H:i:s';
    // 定义时间戳字段名
    protected $createTime = 'create_dt';
    protected $updateTime = 'update_dt';
    protected $deleteTime = 'delete_dt';  

    public function admin()
    {
        return $this->belongsTo('admin', 'salesman_admin_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }

    public function user()
    {
        return $this->belongsTo('user', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }

}
